Completed
Push — master ( c24ce2...7d4320 )
by Yannick
32:41
created

map.3d.weather.js ➔ delete_clouds   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
c 1
b 0
f 0
nc 3
dl 0
loc 8
rs 9.4285
nop 0
1
/**
2
 * This javascript is part of FlightAirmap.
3
 *
4
 * Copyright (c) Ycarus (Yannick Chabanois) <[email protected]>
5
 * Licensed under AGPL license.
6
 * For more information see: https://www.flightairmap.com/
7
*/
8
9
function clickDisplayWeather(cb) {
10
    createCookie('show_Weather',cb.checked,2);
11
//    window.location.reload();
12
}
13
14
var cloudscenter;
15
function delete_clouds() {
16
	for (var i =0; i < viewer.dataSources.length; i++) {
0 ignored issues
show
Bug introduced by
The variable viewer seems to be never declared. If this is a global, consider adding a /** global: viewer */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
17
		if (viewer.dataSources.get(i).name == 'clouds') {
18
			viewer.dataSources.remove(viewer.dataSources.get(i),true);
19
			break;
20
		}
21
	}
22
}
23
24
function create_clouds(cposition) {
25
	//console.log('Create clouds');
26
	cloudscenter = cposition;
27
	$.getJSON('/weather-json.php?latitude='+Cesium.Math.toDegrees(cposition.latitude)+'&longitude='+Cesium.Math.toDegrees(cposition.longitude),function(data) {
0 ignored issues
show
Bug introduced by
The variable Cesium seems to be never declared. If this is a global, consider adding a /** global: Cesium */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
28
		//delete_clouds();
29
		var coord = A.EclCoord.fromWgs84(Cesium.Math.toDegrees(cposition.latitude),Cesium.Math.toDegrees(cposition.longitude),0);
0 ignored issues
show
Bug introduced by
The variable Cesium seems to be never declared. If this is a global, consider adding a /** global: Cesium */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Bug introduced by
The variable A seems to be never declared. If this is a global, consider adding a /** global: A */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
30
		var tp = A.Solar.topocentricPosition(new A.JulianDay(new Date(viewer.clock.currentTime.toString())),coord,true);
0 ignored issues
show
Bug introduced by
The variable viewer seems to be never declared. If this is a global, consider adding a /** global: viewer */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
31
		var tpn = A.Solar.topocentricPosition(new A.JulianDay(new Date(Cesium.JulianDate.addSeconds(viewer.clock.currentTime,60,new Cesium.JulianDate()).toString())),coord,true);
32
		console.log(tp.hz);
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
33
		console.log(tpn.hz);
34
		var ctime = Cesium.JulianDate.toGregorianDate(viewer.clock.currentTime);
35
		var chour = ctime['hour'];
36
		var cminute = ctime['minute'];
37
		var datasource = new Cesium.CustomDataSource('clouds');
38
		var clouds = {ci: ['cirrocumulus1.glb','cirrocumulus2.glb','cirrocumulus3.glb','cirrocumulus4.glb','cirrocumulus5.glb','cirrocumulus6.glb','cirrocumulus7.glb','cirrocumulus8.glb','cirrocumulus9.glb']}; 
39
		    //ac: ['altocumulus1.glb','altocumulus2.glb','altocumulus3.glb','altocumulus4.glb','altocumulus5.glb','altocumulus6.glb'], 
40
		    //ns: ['nimbus1.glb','nimbus_sl1.glb','nimbus_sl2.glb','nimbus_sl3.glb','nimbus_sl4.glb','nimbus_sl5.glb','nimbus_sl6.glb']};
41
		    //st: ['stratus1.glb','stratus2.glb','stratus3.glb','stratus4.glb','stratus5.glb']};
42
		    // st need to follow camera
43
		var cloudsb = {ac: ['altocumulus1.png','altocumulus2.png','altocumulus3.png','altocumulus4.png','altocumulus5.png','altocumulus6.png','altocumulus7.png','altocumulus8.png','altocumulus9.png'], 
44
		    st: ['stratus1.png','stratus2.png','stratus3.png','stratus4.png','stratus5.png','stratus6.png'],
45
		    sc: ['congestus1.png','congestus2.png','congestus3.png'],
46
		    cu: ['cumulus1.png','cumulus2.png','cumulus3.png','cumulus4.png','cumulus5.png','cumulus6.png','cumulus7.png','cumulus8.png','cumulus9.png']};
47
		for (var i = 0; i < data.length; i++) {
48
			var height = data[i]['alt'];
49
			var cov = data[i]['cov'];
50
			var cloud = clouds[data[i]['type']];
51
			//var cloud = clouds['ci'];
52
			//var cloudb = cloudsb['fg'];
53
			var cloudb = cloudsb[data[i]['type']];
54
			var rh = data[i]['rh'];
55
			/*
56
			var timecolors = [[100,100,100],[255,150,100],[255,255,255],[255,255,255],[255,255,255],[255,255,255],[255,150,100],[100,100,100],[100,100,100],[100,100,100],[100,100,100]];
57
			var timecolorsstep = chour/24*10;
58
			if (Math.round(timecolorsstep) > Math.ceil(timecolorsstep)) {
59
				console.log(Math.ceil(timecolorsstep));
60
				var prevcolor = timecolors[Math.ceil(timecolorsstep)];
61
				var nextcolor = timecolors[Math.round(timecolorsstep)];
62
			} else {
63
				if (Math.round(timecolorsstep) == 0) {
64
					var prevcolor = timecolors[0];
65
				} else {
66
					var prevcolor = timecolors[Math.round(timecolorsstep)-1];
67
				}
68
				var nextcolor = timecolors[Math.round(timecolorsstep)];
69
			}
70
			var currentcolor = getColor(prevcolor,nextcolor,3*60,(timecolorsstep%3)*60+cminute);
71
			var color = new Cesium.Color.multiply(new Cesium.Color(rh/100,rh/100,rh/100,1),new Cesium.Color.fromBytes(currentcolor['r'],currentcolor['v'],currentcolor['b'],255), new Cesium.Color());
72
			*/
73
			//var color = new Cesium.Color(rh/100,rh/100,rh/100,1);
74
			
75
			// 17:17 => az : 1.008 - alt : -0.021
76
			
77
			if (tp.hz.alt < 0) prevcolor = [100,100,100];
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
Bug introduced by
The variable prevcolor seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.prevcolor.
Loading history...
78
			else if (tp.hz.alt < 0.172) prevcolor = [255,150,100];
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
79
			else if (tp.hz.alt < Math.PI/2) prevcolor = [255,255,255];
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
80
			else if (tp.hz.alt < 2.9) prevcolor = [255,255,255];
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
81
			else if (tp.hz.alt < 3.0) prevcolor = [255,150,100];
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
82
			else prevcolor = [100,100,100];
83
			if (tpn.hz.alt < 0) nextcolor = [100,100,100];
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
Bug introduced by
The variable nextcolor seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.nextcolor.
Loading history...
84
			else if (tpn.hz.alt < 0.172) nextcolor = [255,150,100];
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
85
			else if (tpn.hz.alt < Math.PI/2) nextcolor = [255,255,255];
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
86
			else if (tpn.hz.alt < 2.9) nextcolor = [255,255,255];
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
87
			else if (tpn.hz.alt < 3.0) nextcolor = [255,150,100];
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
88
			else nextcolor = [100,100,100];
89
			var timecolorsstep = chour/24*10;
90
			var currentcolor = getColor(prevcolor,nextcolor,3*60,(timecolorsstep%3)*60+cminute);
91
			var color = new Cesium.Color.multiply(new Cesium.Color(rh/100,rh/100,rh/100,1),new Cesium.Color.fromBytes(currentcolor['r'],currentcolor['v'],currentcolor['b'],255), new Cesium.Color());
92
93
			if (typeof cloudb != 'undefined') {
94
				for (j = 0; j < 2000*cov; j++) {
0 ignored issues
show
Bug introduced by
The variable j seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.j.
Loading history...
95
					var cloudcoord = generateRandomPoint(Cesium.Math.toDegrees(cposition.latitude),Cesium.Math.toDegrees(cposition.longitude), height,240,70000);
96
					var position = Cesium.Cartesian3.fromDegrees(cloudcoord['longitude'],cloudcoord['latitude'],cloudcoord['alt']);
97
					var heading = Cesium.Math.toRadians(135);
98
					var pitch = 0;
99
					var roll = 0;
100
					var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
101
					var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr);
102
					var urlb = '/images/weather/clouds/'+cloudb[Math.floor((Math.random() * cloudb.length))];
103
					var entity = datasource.entities.add({
0 ignored issues
show
Unused Code introduced by
The variable entity seems to be never used. Consider removing it.
Loading history...
104
					    name : url,
0 ignored issues
show
Bug introduced by
The variable url seems to not be initialized for all possible execution paths.
Loading history...
105
					    position : position,
106
					    orientation : orientation,
107
					    billboard: {
108
						image : urlb,
109
						sizeInMeters: true,
110
						scale: Math.random()*10.0,
111
						horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
112
						verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
113
						eyeOffset: new Cesium.Cartesian3(0,6,0),
114
						heightReference: Cesium.HeightReference.RELATIVE_TO_GROUND,
115
						//fillColor: Cesium.Color.fromCssColorString("#ffc107"),
116
						//translucencyByDistance: new Cesium.NearFarScalar(200,.8,5E4,.2)
117
						distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0.0,70000.0),
118
						translucencyByDistance: new Cesium.NearFarScalar(1E5/2,.9,1E5,.3),
119
						color: color,
120
						opacity: .9
121
					    }
122
					});
123
				}
124
			}
125
			//console.log(data[i]);
126
			//console.log(cloud);
127
			if (typeof cloud != 'undefined') {
128
				console.log('models');
129
				for (j = 0; j < 1000*cov; j++) {
130
					var cloudcoord = generateRandomPoint(Cesium.Math.toDegrees(cposition.latitude),Cesium.Math.toDegrees(cposition.longitude), height,240,70000);
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable cloudcoord already seems to be declared on line 95. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
131
					//console.log(cloudcoord);
132
					var position = Cesium.Cartesian3.fromDegrees(cloudcoord['longitude'],cloudcoord['latitude'],cloudcoord['alt']);
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable position already seems to be declared on line 96. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
133
					if (data[i]['type'] == 'st') {
134
						var heading = camera.heading;
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable heading already seems to be declared on line 97. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
Bug introduced by
The variable camera seems to be never declared. If this is a global, consider adding a /** global: camera */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
135
					} else {
136
						var heading = Cesium.Math.toRadians(135);
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable heading already seems to be declared on line 97. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
137
					}
138
					var pitch = 0;
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable pitch already seems to be declared on line 98. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
139
					var roll = 0;
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable roll already seems to be declared on line 99. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
140
					var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable hpr already seems to be declared on line 100. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
141
					var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr);
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable orientation already seems to be declared on line 101. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
142
					var url = '/models/gltf2/weather/'+cloud[Math.floor((Math.random() * cloud.length))];
143
					var entity = datasource.entities.add({
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable entity already seems to be declared on line 103. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
144
					    name : url,
145
					    position : position,
146
					    orientation : orientation,
147
					    model : {
148
						uri : url,
149
						minimumPixelSize : 1,
150
						maximumScale : 20000,
151
						heightReference: Cesium.HeightReference.RELATIVE_TO_GROUND,
152
						color: color,
153
						colorBlendMode: Cesium.ColorBlendMode.MIX,
154
						distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0.0,70000.0),
155
						allowPicking: false
156
					    }
157
					});
158
				}
159
			}
160
		}
161
		viewer.dataSources.add(datasource);
162
	});
163
}
164
165
166
var handler_all = new Cesium.ScreenSpaceEventHandler(viewer.canvas);
167
handler_all.setInputAction(function(click) {
168
	var pickedObject = viewer.scene.pick(click.position);
0 ignored issues
show
Bug introduced by
The variable viewer seems to be never declared. If this is a global, consider adding a /** global: viewer */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
169
	if (Cesium.defined(pickedObject) && getCookie('show_Weather') == 'true') {
0 ignored issues
show
Bug introduced by
The variable Cesium seems to be never declared. If this is a global, consider adding a /** global: Cesium */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
170
		delete_clouds();
171
		var cposition = pickedObject.id.position.getValue(viewer.clock.currentTime);
172
		create_clouds(viewer.scene.globe.ellipsoid.cartesianToCartographic(cposition));
173
	}
174
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
175
176
177
viewer.clock.onTick.addEventListener(function(clock) {
178
	if (getCookie('show_Weather') == 'true') {
179
		if (Cesium.defined(viewer.trackedEntity)) {
0 ignored issues
show
Bug introduced by
The variable viewer seems to be never declared. If this is a global, consider adding a /** global: viewer */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Bug introduced by
The variable Cesium seems to be never declared. If this is a global, consider adding a /** global: Cesium */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
180
			if (typeof cloudscenter == 'undefined') {
181
				var cposition = viewer.trackedEntity.position.getValue(viewer.clock.currentTime);
182
				create_clouds(viewer.scene.globe.ellipsoid.cartesianToCartographic(cposition));
183
			} else {
184
				var cposition = viewer.trackedEntity.position.getValue(viewer.clock.currentTime);
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable cposition already seems to be declared on line 181. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
185
				var ellipsoidGeodesic = new Cesium.EllipsoidGeodesic(Cesium.Cartographic.fromCartesian(cposition),cloudscenter);
186
				var distance = ellipsoidGeodesic.surfaceDistance;
187
				if (distance > 25000) {
188
					create_clouds(viewer.scene.globe.ellipsoid.cartesianToCartographic(cposition));
189
				}
190
			}
191
		} else {
192
			delete_clouds();
193
		}
194
	}
195
});
196